package com.ylxn.mapper;

import com.sun.tools.corba.se.idl.constExpr.Or;
import com.ylxn.pojo.Order;
import com.ylxn.pojo.User;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface IOrderMapper {

    @Results({
            @Result(property = "id",column = "id"),
            @Result(property = "ordertime",column = "ordertime"),
            @Result(property = "total",column = "total"),
            @Result(property = "user",column = "uid" ,javaType = User.class
                    ,one = @One(select = "com.ylxn.mapper.IUserMapper.findUserById")),
    })
    @Select("select * from orders")
    public List<Order> findOrderAndUser();

    @Select("select * from orders where id = #{uid}")
    public List<Order> findOrderById(Integer uid);
}
